// Lee FocusIMG 0.5 http://www.xij.cn/blog/?p=38

jQuery.fn.focusImg=function(){
 var obj=$(this);
 objName=obj.attr("id");
 obj.children("ul").attr("id",objName+"-fragment");
 var num=(obj.children("ul").children("li").length)-1;
 var temp_b=new String();
 for(var i=0;i<=num;i++){
  temp_b+="<a id=\""+objName+"-button-"+i+"\" href=\"#"+objName+"-fragment-"+i+"\">"+(i+1)+"</a>";
  obj.children("ul").children("li").eq(i).attr("id",objName+"-fragment-"+i)
 }
 obj.append("<span id='"+objName+"-button'>"+temp_b+"</span>");
 obj.children("span").children("a").eq(num).addClass("a2");

 obj.children("span").children("a").click(function(){
   obj.children("span").children("a").removeClass("a2");
   $(this).addClass("a2");
   var id=($(this).attr("id")).replace("button","fragment");
   $("#"+id).appendTo(obj.children("ul"));
   return false;
 });

 topBoxRun=function(){
  obj.children("ul").children("li").eq(num).slideUp("slow",function(){
   obj.children("span").children("a").removeClass("a2");
   var id=($(this).prev().attr("id")).replace("fragment","button");
   $("#"+id).addClass("a2");
   $(this).prependTo(obj.children("ul"));
   $(this).show();
  }); 
 }

 var t=setInterval(topBoxRun,5000);
}